package lab02.test34;



import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
public class Test34 {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("apple");
        list.add("grape");
        list.add("pear");
        list.add("banana");           //为了列表添加元素


        System.out.println("集合的最大元素:" + Collections.max(list));      //运用collertions工具类获得最大和最小值
        System.out.println("集合的最小元素:" + Collections.min(list));

        Collections.sort(list);
        System.out.println("对集合进行排序(升序):");
        for(int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
    }

}
